package com.arpa.wms.domain.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.Digits;
import javax.validation.constraints.NotEmpty;
import java.math.BigDecimal;

/**
 * <p>
 * WMS调拨单明细
 * </p>
 *
 * @author LEO
 * @since 2020-11-17
 */
@Data
@NoArgsConstructor                 //无参构造
@AllArgsConstructor                //有参构造
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("wms_allocation_item")
@ApiModel(value="AllocationItem对象", description="WMS调拨单明细")
public class AllocationItem extends BasicEntity {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "数据标识")
    @TableField("code")
    private String code;

    @ApiModelProperty(value = "组织机构")
    @TableField("group_code")
    private String groupCode;

    @ApiModelProperty(value = "调拨单号")
    @TableField("allocation_code")
    private String allocationCode;

    @ApiModelProperty(value = "商品标识")
    @TableField("goods_code")
    @NotEmpty(message = "调拨单明细商品标识不能为空！", groups = {Allocation.Save.class, Allocation.Update.class})
    private String goodsCode;

    @ApiModelProperty(value = "商品编码")
    @TableField("good_code")
    @NotEmpty(message = "调拨单明细商品编码不能为空！", groups = {Allocation.Save.class, Allocation.Update.class})
    private String goodCode;

    @ApiModelProperty(value = "商品名称")
    @TableField("goods_name")
    private String goodsName;

    @ApiModelProperty(value = "商品条码")
    @TableField("goods_bar_code")
    @NotEmpty(message = "调拨单明细商品条码不能为空！", groups = {Allocation.Save.class, Allocation.Update.class})
    private String goodsBarCode;

    @ApiModelProperty(value = "商品规格")
    @TableField("spec")
    private String spec;

    @ApiModelProperty(value = "基本单位数量")
    @TableField("allocation_quantity")

    private BigDecimal allocationQuantity;

    @ApiModelProperty(value = "商品保质期（天）")
    @TableField("expiration_quantity")
    @Digits(integer = 20,fraction = 6, groups = {Allocation.Save.class, Allocation.Update.class})
    private BigDecimal expirationQuantity;

    @ApiModelProperty(value = "单位数量")
    @TableField("allocation_unit_quantity")
    @DecimalMin(value = "0.000001", message = "调拨单明细调拨数量数量过小", groups = {Allocation.Save.class, Allocation.Update.class})
    @Digits(integer = 20,fraction = 6, groups = {Allocation.Save.class, Allocation.Update.class})
    private BigDecimal allocationUnitQuantity;

    @ApiModelProperty(value = "基本单位出库数量")
    @TableField("outbound_quantity")
    @Digits(integer = 20,fraction = 6, groups = {Allocation.Save.class, Allocation.Update.class})
    private BigDecimal outboundQuantity;

    @ApiModelProperty(value = "单位出库数量")
    @TableField("outbound_unit_quantity")
    @Digits(integer = 20,fraction = 6, groups = {Allocation.Save.class, Allocation.Update.class})
    private BigDecimal outboundUnitQuantity;

    @ApiModelProperty(value = "基本单位入库数量")
    @TableField("inbound_quantity")
    @Digits(integer = 20,fraction = 6, groups = {Allocation.Save.class, Allocation.Update.class})
    private BigDecimal inboundQuantity;

    @ApiModelProperty(value = "单位入库数量")
    @TableField("inbound_unit_quantity")
    @Digits(integer = 20,fraction = 6, groups = {Allocation.Save.class, Allocation.Update.class})
    private BigDecimal inboundUnitQuantity;

    @ApiModelProperty(value = "件装量")
    @TableField("unit_convert_quantity")
    @Digits(integer = 20,fraction = 6, groups = {Allocation.Save.class, Allocation.Update.class})
    private BigDecimal unitConvertQuantity;

    @ApiModelProperty(value = "调拨单位")
    @TableField("allocation_unit")
    @NotEmpty(message = "调拨单明细调拨单位不能为空！", groups = {Allocation.Save.class, Allocation.Update.class})
    private String allocationUnit;

    @ApiModelProperty(value = "调拨单位名称")
    @TableField("allocation_unit_name")
    @NotEmpty(message = "调拨单明细调拨单位名称不能为空！", groups = {Allocation.Save.class, Allocation.Update.class})
    private String allocationUnitName;

    @ApiModelProperty(value = "商品基本单位")
    @TableField("basic_unit")
    @NotEmpty(message = "调拨单明细调拨商品基本单位不能为空！", groups = {Allocation.Save.class, Allocation.Update.class})
    private String basicUnit;

    @ApiModelProperty(value = "基本单位名称")
    @TableField("basic_unit_name")
    @NotEmpty(message = "调拨单明细调拨商品基本单位名称不能为空！", groups = {Allocation.Save.class, Allocation.Update.class})
    private String basicUnitName;

    @ApiModelProperty(value = "备注")
    @TableField("remarks")
    @Length(max = 255, message = "调拨单明细备注长度不能大于255", groups = {Allocation.Save.class, Allocation.Update.class})
    private String remarks;

}
